#ifndef _FIG_ENEMYBULLET_MASTER_H_
#define _FIG_ENEMYBULLET_MASTER_H_


#include "fig_bullet.h"
#include "math/vec2.h"
#include "fig_sounds.h"
#include <vector>

class FIGBulletManager;
class FIGEnemyCraft;
class FIGLifeObj;
class FIGBonePart;

class FIGEnemyBulletMaster
{

public:

	enum	BULLET_TYPES
	{
		BULLET_TYPE_CIRCLE_ROTATE,
		BULLET_TYPE_CIRCLE_GLOW,
		BULLET_TYPE_CIRCLE_DOUBLELAYER,
		BULLET_TYPE_CIRCLE_TRIPPLELAYER,		

		BULLET_TYPE_LONG_GREEN,
		BULLET_TYPE_LONG_RED,
		BULLET_TYPE_LONG_YELLOW,
		BULLET_TYPE_LONG_CYAN,
		
		BULLET_TYPES_SFX_FIRE,

		BULLET_TYPES_ROCKET,

		BULLET_TYPES_COUNT,

	};	

	struct  DelayShootInfo
	{
		
        FIGLifeObj*							pShooter;
		math::Vec2							GunPos;
		FIGEnemyBulletMaster::BULLET_TYPES	Type;
		FIGBullet::SHOOT_STYLES				ShootStyle;
		float								Degree;
		float								Delay;
		bool								IsShootToPlayer;

		FIGBonePart*						ShootBone;
		bool								bIsOppositeBone;
		FIGSounds::SOUND_NAMES				Sfx;

		DelayShootInfo() : pShooter(NULL),
			Type(FIGEnemyBulletMaster::BULLET_TYPE_CIRCLE_ROTATE),
			ShootStyle(FIGBullet::SHOOT_STYLES_SINGLE),
			Degree(0),
			Delay(0),
			IsShootToPlayer(false),
			ShootBone(NULL),
			bIsOppositeBone(false),
			Sfx(FIGSounds::SFX_NONE)
		{

		};
	};
	
	static FIGEnemyBulletMaster&			Instance();

	
	void									Render(const math::Vec2& Offset,float Scale);
	void									RenderDebug(const math::Vec2& Offset,float Scale);
	void									Tick(float dt);
	
	

	void									Shoot(
												FIGLifeObj*							pShooter,
												const math::Vec2&					GunPos,
												FIGEnemyBulletMaster::BULLET_TYPES	Type,
												FIGBullet::SHOOT_STYLES				ShootStyle,
												float								Degree,
												float								Delay,
												bool								IsShootToPlayer,
												FIGBonePart*						pShootBone,
												bool								bIsOppositeBone = false,
												FIGSounds::SOUND_NAMES				Sfx = FIGSounds::SFX_NONE
												);



	void									Clear();		// this is memory clearing
	void									DieAll();		// this one for clearing screen

	

protected:

	void									InternalShoot(DelayShootInfo* ShootInfo);
		
	FIGEnemyBulletMaster();
	~FIGEnemyBulletMaster();


	FIGBulletManager*						m_BulletManagers[BULLET_TYPES_COUNT];

	std::vector<DelayShootInfo*>			m_DelayShootInfos;	
	std::vector<DelayShootInfo*>			m_OldDelayShootInfos;


private:

	void									AddToManager(BULLET_TYPES TYPE);


};

#endif